package composite;

import java.util.ArrayList;
import java.util.List;

public class Folder extends AbstractFile{
    List<AbstractFile> children = new ArrayList<AbstractFile>();

    @Override
    public boolean add(AbstractFile file) {
        return children.add(file);
    }

    @Override
    public boolean remove(AbstractFile file) {
        return children.remove(file);
    }

    @Override
    public AbstractFile getChild(int i) {
        return children.get(i);
    }

    @Override
    public void KillVirus() {
        System.out.println("进入文件夹，对文件夹里的文件进行杀毒");
        for (AbstractFile file : children) {
            file.KillVirus();
        }
    }
}